<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <title>商务支付申请单复制</title>
</head>
<style>
	.fieldset{
		margin-top: 5px;
		margin-bottom: 0px
	}
	.layui-legend{
		background-color:#5fb878;
		font-size:15px !important;
		width:140px;
	}
	.layui-form-item {
	    margin-bottom: 5px;
	    clear: both;
	    *zoom: 1;
	}
	.layui-form-label{width: 180px;}
</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
	    <div class="layui-tab-item layui-show">
	    	<div style="padding-top:15px;">&nbsp;</div>
			<form class="layui-form" id="addInfo_form" lay-filter="add_info_from">
				<fieldset class="layui-elem-field layui-field-title fieldset"  id="baseInfo">
				  <legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">项目基础信息  ></legend>
				  <div style="margin-top:20px">
				  	<div class="layui-form-item">
				  		<div class="layui-inline">
					      	<label class="layui-form-label">申请公司</label>
					      	<div class="layui-input-inline">
								<input type="text" value="${bindOrgName}" style="border:0px;width:220px" readonly="readonly" class="layui-input">
					      	</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">申请部门</label>
				      		<div class="layui-input-inline">
								<input type="text" value="${bindDeptName}" style="border:0px;" readonly="readonly" class="layui-input">
				      		</div>
					    </div>
					    <div class="layui-inline">
					    	<label class="layui-form-label">申请人</label>
				      		<div class="layui-input-inline">
				        		<input type="text" value="${SESSION_KEY_USER_DETAIL.realName }" readonly="readonly" style="border:0px" class="layui-input">
				      		</div>
					    </div>
				    </div>
		    	    <div class="layui-form-item">
				    	<div class="layui-inline">
							<label class="layui-form-label">项目名称</label>
							<div class="layui-input-inline">
								<%-- <select name="id" id="add_select_proId" lay-verify="required"
									lay-filter="add_select_proId" lay-search>
									<option value="">请选择</option>
									<c:if test="${not empty contractList}">
										<c:forEach items="${contractList}" var="contract">
											<option value="${contract.id}" procode="${contract.proCode }" carryorg="${contract.carryOrg }" proleader="${contract.proLeader }">${contract.proName}</option>
										</c:forEach>
									</c:if>
								</select> --%>
								<input type="text" name="proName" value="${bizcostApply.proName}" 
									style="border:0px;width:265px" readonly="readonly" class="layui-input">
						        <input type="hidden" id="proCode" name="proCode" value="${bizcostApply.proCode}">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">实施机构</label>
							<div class="layui-input-inline">
								<input type="text" id="carryOrg" value="${bizcostApply.carryOrg}" style="border: 0px;width:220px" name="carryOrg" readonly="readonly" class="layui-input">
							</div>
						</div>
				    	<div class="layui-inline">
							<label class="layui-form-label">项目负责人</label>
							<div class="layui-input-inline">
								<input type="text" id="proLeader" value="${bizcostApply.proLeader}" style="border: 0px;" name="proLeader" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
				    <div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">确权月份</label>
							<div class="layui-input-inline">
								<input type="text" class="layui-input" value="<fmt:formatDate value="${bizcostApply.sureMonth }" pattern="yyyy-MM"/>" id="sent-laydate-year" name="sureMonthStr" lay-verify="required" readonly>
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">费用类别</label>
							<div class="layui-input-inline">
								<%-- <infopub:select id="select_feeType" value="${bizcostApply.feeType }" entireName="-费用类别" name="feeType" layFilter="add_select_feeType" layVerify="required" type="dic" groupNo="A00010072"></infopub:select> --%>
								<c:if test="${bizcostApply.feeType=='1'}">
									<input type="text" name="payTypes" value="总包费" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_feeType" name="feeType" value="1" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.feeType=='2'}">
									<input type="text" name="payTypes" value="分包费" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_feeType" name="feeType" value="2" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.feeType=='3'}">
									<input type="text" name="payTypes" value="设备费" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_feeType" name="feeType" value="3" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.feeType=='4'}">
									<input type="text" name="payTypes" value="代付费" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_feeType" name="feeType" value="4" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.feeType=='5'}">
									<input type="text" name="payTypes" value="前期费" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_feeType" name="feeType" value="5" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">支付类别</label>
							<div class="layui-input-inline">
								<%-- <select id="select_payType" value="${bizcostApply.payType }" lay-filter="add_select_payType" name="payType" lay-verify="required"></select> --%>
								<c:if test="${bizcostApply.payType=='1'}">
									<input type="text" name="payTypes" value="预付款" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_payType" name="payType" value="1" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.payType=='2'}">
									<input type="text" name="payTypes" value="月度进度款" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_payType" name="payType" value="2" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.payType=='3'}">
									<input type="text" name="payTypes" value="年度进度款" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_payType" name="payType" value="3" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.payType=='4'}">
									<input type="text" name="payTypes" value="竣工付费" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_payType" name="payType" value="4" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.payType=='5'}">
									<input type="text" name="payTypes" value="结算工程款" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_payType" name="payType" value="5" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.payType=='6'}">
									<input type="text" name="payTypes" value="质保金返还" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_payType" name="payType" value="6" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.payType=='7'}">
									<input type="text" name="payTypes" value="代付费" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_payType" name="payType" value="7" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
								<c:if test="${bizcostApply.payType=='8'}">
									<input type="text" name="payTypes" value="前期费" style="border: 0px;" readonly="readonly" class="layui-input">
									<input type="hidden" id="select_payType" name="payType" value="8" style="border: 0px;" readonly="readonly" class="layui-input">
								</c:if>
							</div>
						</div>
					</div>
				    <div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">合同类别</label>
							<div class="layui-input-inline">
								<input type="text" id="cotTypeName" value="${bizcostApply.cotType == '1' ? '内部协议':bizcostApply.cotType == '2' ? '分包合同': bizcostApply.cotType == '3' ? '设备合同':'其他对内合同'}" style="border: 0px;" readonly="readonly" class="layui-input">
								<input type="hidden" id="cotType" name="cotType" value="${bizcostApply.cotType}">
								<input type="hidden" id="cotName" name="cotName">
							</div>
						</div>
				    	<div class="layui-inline">
							<label class="layui-form-label">合同名称</label>
							<div class="layui-input-inline">
								<select name="cotId" id="select_cotName" lay-verify="required" lay-filter="add_select_cotId" lay-search>
								</select>
								<input type="hidden" id="cotNames" name="cotNames" value="${bizcostApply.cotName }" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">单位名称</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.coopName}" id="sgCoopName" name="coopName" style="border: 0px;width:220px" readonly="readonly" class="layui-input">
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">申请付款总额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.payTotal}" id="payTotal" name="payTotal" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
					</div>
		  		</div>
			</fieldset>
			<c:if test="${bizcostApply.payType == '1'}">
			<fieldset class="layui-elem-field layui-field-title fieldset detail" id="detail1">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">预付款信息 ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">合同金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.preCotAmount}" id="preCotAmount" name="bizcostApplyDetail.preCotAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">预付款比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.preRate}" id="preRate" name="bizcostApplyDetail.preRate" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">应付预付款金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.prePayAmount}" id="prePayAmount" name="bizcostApplyDetail.prePayAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  	</div>
			</fieldset>
			</c:if>
			<c:if test="${bizcostApply.payType == '2'}">
			<fieldset class="layui-elem-field layui-field-title fieldset detail" id="detail2">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">月度进度款信息 ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">已确权产值（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.monthSureAmount}" id="monthSureAmount" name="bizcostApplyDetail.monthSureAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">月度付款比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.monthPayRate}" id="monthPayRate" name="bizcostApplyDetail.monthPayRate" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">综合计划调整付款比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.monthAdjustRate}" id="monthAdjustRate" name="bizcostApplyDetail.monthAdjustRate" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">当月实际付款比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.monthActRate}" id="monthActRate" name="bizcostApplyDetail.monthActRate" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">当月应付金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.monthShouldAmount}" id="monthShouldAmount" name="bizcostApplyDetail.monthShouldAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">财务增减金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.monthReviseAmount}" id="monthReviseAmount" name="bizcostApplyDetail.monthReviseAmount" autocomplete="off" maxlength="13" onblur="calcMonthActAmount(this);arabiaToCN(this,1);" lay-verify="required|floatNumber" class="layui-input required">
							</div>
						</div>
				    </div>
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">当月实际应付金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.monthActAmount}" id="monthActAmount" name="bizcostApplyDetail.monthActAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  	</div>
			</fieldset>
			</c:if>
			<c:if test="${bizcostApply.payType == '3'}">
			<fieldset class="layui-elem-field layui-field-title fieldset detail" id="detail3">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">年度进度款信息 ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">年度付款开始月</label>
							<div class="layui-input-inline">
								<input type="text" value="<fmt:formatDate value="${bizcostApply.bizcostApplyDetail.yearPayBegin }" pattern="yyyy-MM"/>" class="layui-input required" id="yearPayBeginStr" name="yearPayBeginStr" lay-verify="required" readonly>
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">年度付款结束月</label>
							<div class="layui-input-inline">
								<input type="text" class="layui-input required" value="<fmt:formatDate value="${bizcostApply.bizcostApplyDetail.yearPayEnd }" pattern="yyyy-MM"/>" id="yearPayEndStr" name="yearPayEndStr" lay-verify="required" readonly>
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">年度确权产值（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.yearSureAmount }" id="yearSureAmount" name="bizcostApplyDetail.yearSureAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">年度付款比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.yearPayRate}" id="yearPayRate" name="bizcostApplyDetail.yearPayRate" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">年度应付金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.yearShouldAmount}" id="yearShouldAmount" name="bizcostApplyDetail.yearShouldAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">财务增减金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.yearReviseAmount}" id="yearReviseAmount" name="bizcostApplyDetail.yearReviseAmount" autocomplete="off"  onblur="calcYearActPay(this);arabiaToCN(this,1);" maxlength="13" lay-verify="required|floatNumber" class="layui-input required">
							</div>
						</div>
				    </div>
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">年度实际应付金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.yearActPay}" id="yearActPay" name="bizcostApplyDetail.yearActPay" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  	</div>
			</fieldset>
			</c:if>
			<c:if test="${bizcostApply.payType == '4'}">
			<fieldset class="layui-elem-field layui-field-title fieldset detail" id="detail4">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">竣工付费信息 ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">开累确权产值（元）（至竣工期）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.overAddupAmount}" id="overAddupAmount" name="bizcostApplyDetail.overAddupAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">竣工付款比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.overPayRate}" id="overPayRate" name="bizcostApplyDetail.overPayRate" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">竣工应付金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.overShouldAmount}" id="overShouldAmount" name="bizcostApplyDetail.overShouldAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">财务增减金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.overReviseAmount}" id="overReviseAmount" name="bizcostApplyDetail.overReviseAmount" autocomplete="off"  onblur="calcOverShouldFee(this);arabiaToCN(this,1);" maxlength="13" lay-verify="required|floatNumber" class="layui-input required">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">竣工应付款（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.overShouldFee}" id="overShouldFee" name="bizcostApplyDetail.overShouldFee" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  	</div>
			</fieldset>
			</c:if>
			<c:if test="${bizcostApply.payType == '5'}">
			<fieldset class="layui-elem-field layui-field-title fieldset detail" id="detail5">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">结算工程款信息 ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">工程结算价（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.settProAmount}" id="settProAmount" name="bizcostApplyDetail.settProAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">结算付款比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.settPayRate}" id="settPayRate" name="bizcostApplyDetail.settPayRate" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">应付款（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.settShouldFee}" id="settShouldFee" name="bizcostApplyDetail.settShouldFee" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">财务增减金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.settReviseAmount}" id="settReviseAmount" name="bizcostApplyDetail.settReviseAmount" autocomplete="off"  onblur="calcSettShouldAmount(this);arabiaToCN(this,1);" maxlength="13" lay-verify="required|floatNumber" class="layui-input required">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">结算应付金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.settShouldAmount}" id="settShouldAmount" name="bizcostApplyDetail.settShouldAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  	</div>
			</fieldset>
			</c:if>
			<c:if test="${bizcostApply.payType == '6'}">
			<fieldset class="layui-elem-field layui-field-title fieldset detail" id="detail6">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">质保金返还信息 ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">工程结算价（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.backProAmount}" id="backProAmount" name="bizcostApplyDetail.backProAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">质保金比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.backQaRate}" id="backQaRate" name="bizcostApplyDetail.backQaRate" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">实扣质保金（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.backQaAct}" id="backQaAct" name="bizcostApplyDetail.backQaAct" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">已扣质保金（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.backQaAlready}" id="backQaAlready" name="bizcostApplyDetail.backQaAlready" autocomplete="off"  onblur="calcBackAmount(this);arabiaToCN(this,1);" maxlength="13" lay-verify="required|floatAmount" class="layui-input required">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">质保金返还金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.backAmount}" id="backAmount" name="bizcostApplyDetail.backAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  	</div>
			</fieldset>
			</c:if>
			<c:if test="${bizcostApply.payType == '7'}">
			<fieldset class="layui-elem-field layui-field-title fieldset detail" id="detail7">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">代付费信息 ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">代付费确权金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.replaceSureAmout}" id="replaceSureAmout" name="bizcostApplyDetail.replaceSureAmout" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">支付比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.replacePayRate}" id="replacePayRate" autocomplete="off" onblur="calcReplaceShouldAmount(this);" name="bizcostApplyDetail.replacePayRate" maxlength="6" lay-verify="required|floatAmount" class="layui-input required">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">本期应付代付费（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.replaceShouldAmount}" id="replaceShouldAmount" name="bizcostApplyDetail.replaceShouldAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  	</div>
			</fieldset>
			</c:if>
			<c:if test="${bizcostApply.payType == '8'}">
			<fieldset class="layui-elem-field layui-field-title fieldset detail" id="detail8">
		  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">前期费信息 ></legend>
			  	<div style="margin-top:20px">
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">前期费确权金额（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.frontSureAmount}" id="frontSureAmount" name="bizcostApplyDetail.frontSureAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">约定支付日期</label>
							<div class="layui-input-inline">
								<input type="text" value="<fmt:formatDate value="${bizcostApply.bizcostApplyDetail.frontAgreeDate}" pattern="yyyy-MM-dd"/>" id="frontAgreeDateStr" name="bizcostApplyDetail.frontAgreeDate" lay-verify="required" readonly class="layui-input required">
							</div>
						</div>
			  			<div class="layui-inline">
							<label class="layui-form-label">支付比例（%）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.frontPayRate}" id="frontPayRate" name="bizcostApplyDetail.frontPayRate" autocomplete="off"  onblur="calcFrontShouldAmount(this);" maxlength="6" lay-verify="required|floatAmount" class="layui-input required">
							</div>
						</div>
				    </div>
			  		<div class="layui-form-item">
			  			<div class="layui-inline">
							<label class="layui-form-label">本期应付前期费（元）</label>
							<div class="layui-input-inline">
								<input type="text" value="${bizcostApply.bizcostApplyDetail.frontShouldAmount}" id="frontShouldAmount" name="bizcostApplyDetail.frontShouldAmount" style="border: 0px;" readonly="readonly" class="layui-input">
							</div>
						</div>
				    </div>
			  	</div>
			</fieldset>
			</c:if>
				<fieldset class="layui-elem-field layui-field-title fieldset" >
			  		<legend class="layui-btn layui-legend" style="text-align:left;cursor:default;">附件  ></legend>
					  	<div style="margin-top:20px;">
						    <div class="layui-form-item">
							    <label class="layui-form-label" style="width:350px;">支持pdf、excel、word、图片资料，可上传多个</label>
							</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">计算稿（选填）</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="1-upload-more">上传</button>
				                		<div class="layui-upload-list" id="1-upload-more-list">
				                		<c:forEach items="${bizcostApply.bizcostApplyAtts }" var="fileAtt">
					              			<c:if test="${fileAtt.types == '1' }">
					              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
					              					<c:choose>
						              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
							              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
							              				</c:when>
							              				<c:otherwise>
							              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
							              				</c:otherwise>
					              					</c:choose>
					              					<div class="mask">
					              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
					              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
					              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtt1" ></input>
					              					</div>
					              					<p>${fileAtt.fileName}</p>	
					              				</div>
					              			</c:if>
					              		</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">签字扫描件（选填）</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="2-upload-more">上传</button>
				                		<div class="layui-upload-list" id="2-upload-more-list">
				                		<c:forEach items="${bizcostApply.bizcostApplyAtts }" var="fileAtt">
					              			<c:if test="${fileAtt.types == '2' }">
					              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
					              					<c:choose>
						              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
							              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
							              				</c:when>
							              				<c:otherwise>
							              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
							              				</c:otherwise>
					              					</c:choose>
					              					<div class="mask">
					              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
					              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
					              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtt2" ></input>
					              					</div>
					              					<p>${fileAtt.fileName}</p>
					              				</div>
					              			</c:if>
					              		</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
						    <div class="layui-form-item">
							    <label class="layui-form-label">其他附件（选填）</label>
							    <div class="layui-input-block">
							    	<div class="layui-upload">
						              	<button type="button" class="layui-btn" id="3-upload-more">上传</button>
				                		<div class="layui-upload-list" id="3-upload-more-list">
				                		<c:forEach items="${bizcostApply.bizcostApplyAtts }" var="fileAtt">
					              			<c:if test="${fileAtt.types == '3' }">
					              				<div class="layui-upload-img-div" id="upload_img_${fileAtt.id }">
					              					<c:choose>
						              					<c:when test="${fileAtt.fileSuffix == '.jpg' or fileAtt.fileSuffix == '.jpeg' or fileAtt.fileSuffix == '.png'}">
							              					<img src="${fileHttpPre }/${fileAtt.filePath }" title="${fileAtt.fileName}" class="layui-upload-img">
							              				</c:when>
							              				<c:otherwise>
							              					<img src="${ctx}/resources/images/${fn:substring(fileAtt.fileSuffix,1,5)}.jpg" title="${fileAtt.fileName}" class="layui-upload-img">
							              				</c:otherwise>
					              					</c:choose>
					              					<div class="mask">
					              						<a href="javascript:void(0)" onclick="showImg('${fileHttpPre}/${fileAtt.filePath }');">查看</a>
					              						<a href="javascript:void(0)" onclick="del('${fileAtt.id}')">删除</a>
					              						<input type="hidden" value="${fileAtt.types}|${fileAtt.fileName}${fileAtt.fileSuffix }||${fileAtt.filePath }" id="fileAtt_${fileAtt.id}" name="fileAtt3" ></input>
					              					</div>
					              					<p>${fileAtt.fileName}</p>
					              				</div>
					              			</c:if>
					              		</c:forEach>
				                		</div>
						            </div>
							    </div>
						  	</div>
					  	</div>
				</fieldset>
				<div class="layui-form-item" style="position: fixed ! important; right: 30px; bottom:45%;z-index:10000;">
					<div class="layui-input-block">
			      		<button class="layui-btn layui-bg-blue layui-btn-normal layui-btn-lg  layui-btn-radius" type="button" lay-submit lay-filter="addInfo_form_submit" id="addInfo_form_submit">
			      		<i class="layui-icon layui-icon-ok layuiadmin-button-btn"></i>
			      		提交
			      		</button>
			      	</div>
			    </div>
			</form>
  		</div>
	</div>
</div>
  <script>
  layui.config({
    base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'set', 'upload', 'element', 'laydate'], function(){
    var $ = layui.$
    ,form = layui.form
    ,element = layui.element
    ,laydate = layui.laydate
    ,upload = layui.upload;
    
    laydate.render({
	      elem: '#sent-laydate-year'
	      ,type: 'month'
	      ,done: function(value, date){
    	  	var payType = $("#select_payType").val();
      		var feeType = $("#select_feeType").val();
      		var cotId = $("#select_cotName").val();
	      	if(payType != '' && feeType != '' && cotId !=''){
     			if(payType != '3'){
	      			getCotByCondition(feeType,payType,cotId,value,'');
	      		}else{
	      			var sureMonthStart = $("#yearPayBeginStr").val();
	      			var sureMonthEnd = $("#yearPayEndStr").val();
	      			if(sureMonthStart !='' && sureMonthEnd !=''){
	      				getCotByCondition(feeType,payType,cotId,sureMonthStart,sureMonthEnd);
	      			}
	      		}
	      	}
	      }
		});
		//开始月份
	    var insStartMonth = laydate.render({
	      elem: '#yearPayBeginStr'
	      ,type: 'month'
	      ,done: function(value, date){
	        //更新结束日期的最小日期
	        insEndMonth.config.min = lay.extend({}, date, {
	          month: date.month - 1
	        });
	        
	        //自动弹出结束日期的选择器
	       	insEndMonth.config.elem[0].focus();
	       	var feeType = $("#select_feeType").val();
	        var payType = $("#select_payType").val();
	    	var cotId = $("#select_cotName").val();
	    	var sureMonthEnd = $("#yearPayEndStr").val();
	    	if(payType != '' && feeType != '' && cotId !='' && sureMonthEnd !='' && value !=''){
   				getCotByCondition(feeType,payType,cotId,value,sureMonthEnd);
	    	}
	      }
	    });
	    
	    //结束月份
	    var insEndMonth = laydate.render({
	      elem: '#yearPayEndStr'
	      ,type: 'month'
	      ,done: function(value, date){
	        //更新开始日期的最大日期
	        insStartMonth.config.max = lay.extend({}, date, {
	          month: date.month - 1
	        });
	        var feeType = $("#select_feeType").val();
	        var payType = $("#select_payType").val();
	    	var cotId = $("#select_cotName").val();
	    	var sureMonth = $("#yearPayBeginStr").val();
	    	if(payType != '' && feeType != '' && cotId !='' && sureMonth !='' && value !=''){
    			getCotByCondition(feeType,payType,cotId,sureMonth,value);
	    	}
	      }
	    });
	    
	    //约定支付日期
	    laydate.render({
	      elem: '#frontAgreeDateStr'
	    });
 	// 正则校验
	form.verify({
		//验证汉字
	    CHS:[
	    	/^[\u0391-\uFFE5]+$/
	    	,'只能输入汉字'
	  	],
	  	//大于0的正整数
	  	intNumber:[
			/^[1-9]\d*$/
			,'请输入正确的数字'
	  	],
	  	//数字只能有两位小数
	  	floatNumber:[
			/^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
			,'请输入正确的数字'
	  	],
	  	//数字大于0，并只能有两位小数
	  	floatAmount:[
			/^([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
			//var pattern=/^((\d+\.\d*[1-9]\d{1})|(\d*[1-9]\d*\.\d{2}))$/; 
			,'请输入正确的数字'
	  	]
	});
	//上传附件
  	upload.render({
	      elem: '#1-upload-more'
	      ,url: basePath + '/bizcostApply/uploadAtt/'
	      ,data: {
	    	  types:1
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var bizcostApplyAtt = res.entity[i];
					var arr = bizcostApplyAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#1-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+bizcostApplyAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt1" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });
	//上传附件
  	upload.render({
	      elem: '#2-upload-more'
	      ,url: basePath + '/bizcostApply/uploadAtt/'
	      ,data: {
	    	  types:2
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var bizcostApplyAtt = res.entity[i];
					var arr = bizcostApplyAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#2-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+bizcostApplyAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt2" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });
	//上传附件
  	upload.render({
	      elem: '#3-upload-more'
	      ,url: basePath + '/bizcostApply/uploadAtt/'
	      ,data: {
	    	  types:3
	    		}
	      ,multiple: true
	      ,accept: 'file'
	      ,acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf'
	   	  ,before: function(obj){ //obj参数包含的信息
	   		    layer.load(); //上传loading
	   		  }
	      ,done: function(res){
	    	  //如果上传失败
	          if(res.code > 0){
	        	  layer.closeAll('loading'); //关闭loading
	        	  return layer.msg(res.msg,{icon: 7});
	          }
	          //上传完毕
	   	  	  if(res.entity != null && res.entity.length > 0){
				for(var i in res.entity){
					var bizcostApplyAtt = res.entity[i];
					var arr = bizcostApplyAtt.split("|");
					var imgSrc = "";
					var suffix = arr[1].substring(arr[1].lastIndexOf(".")+1,arr[1].length);
					if(suffix == 'jpg' || suffix == 'png'){
						imgSrc = "${fileHttpPre}/"+arr[3];
					}else{
						imgSrc = "${ctx}/resources/images/"+suffix+".jpg";
					}
	        		$('#3-upload-more-list').append('<div class="layui-upload-img-div" id="upload_img_'+arr[2]+'"><img src="'+imgSrc+'" title="'+ arr[1] +'" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\''+"${fileHttpPre}"+arr[3] +'\');">查看</a><a href="javascript:void(0)" onclick="del(\''+arr[2]+'\')";>删除</a></div><p>'+arr[1]+'</p><input type="hidden" value="'+bizcostApplyAtt+'" id="fileAtt_'+arr[2]+'" name="fileAtt3" ></input></div> ');
				}
		  	  }
	      }
	      ,allDone: function(obj){ //当文件全部被提交后，才触发
	    	  layer.closeAll('loading'); //关闭loading
	      }
	      ,error: function(){
	    	  layer.closeAll('loading'); //关闭loading
	          //上传失败
	          layer.msg("上传失败，请稍后再试~",{icon: 7});
	        }
	    });
	
   	//监听提交
  	form.on('submit(addInfo_form_submit)', function(data){
  		$("#addInfo_form_submit").removeAttr("lay-submit").removeClass("layui-bg-blue").addClass("layui-btn-disabled");
  		layer.load();
       	//提交 Ajax 成功后，静态更新表格中的数据
       	$.ajax({
           	type : 'post',
			url : basePath + '/bizcostApply/save',
           	data: $('#addInfo_form').serialize(),
			success:function(result){
				if(result.success){
					layer.closeAll('loading'); //关闭loading
					layer.msg('提交单据成功~',{icon: 1});
					//两秒后关闭当前页面
					setTimeout(function(){
						/**
						 * 查找父菜单，并刷新
						 */
						var topDoc = $(window.top.document);
						var path = basePath + '/bizcostApply/list';
						// 获取页面名称
						var name = topDoc.find(".layui-nav-item [lay-href^='" + path + "']").text();
						if(name == '' || name == null){
							name = '商务支付申请单';
						}
						window.parent.layui.index.openTabsPage(path, name);
						var iframe = window.parent.layui.admin.tabsBody(window.parent.layui.admin.tabsPage.index).find(".layadmin-iframe");
						iframe[0].contentWindow.location.reload(true);
						
						/**
						 * 关闭当前页
						 */
						var currPath = basePath + '/bizcostApply/toCopy';
						var layid = topDoc.find("li[lay-id^='" + currPath + "']").attr('lay-id');
						window.parent.layui.element.tabDelete('layadmin-layout-tabs', layid);//关闭当前页
				        }, 2000);
				}else{
					layer.closeAll('loading'); //关闭loading
  					$("#addInfo_form_submit").removeClass("layui-btn-disabled").addClass("layui-bg-blue").attr("lay-submit","");
					layer.msg(result.msg,{icon: 7});
			  	}
			}
       	});
   	});  
 	// data-type事件
    $('.layui-btn.layuiadmin-btn-admin').on('click', function(){
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });
 	
 	//select项目名称监听
    form.on('select(add_select_proId)', function(data) {
		var proName = $("#add_select_proId").find("option:selected").text().trim();
		$("#proName").val(proName);
		var proCode = $("#add_select_proId").find("option:selected").attr("procode");
		$("#proCode").val(proCode);
		var carryOrg = $("#add_select_proId").find("option:selected").attr("carryorg");
		$("#carryOrg").val(carryOrg);
		var proLeader = $("#add_select_proId").find("option:selected").attr("proleader");
		$("#proLeader").val(proLeader);
		//费用类型清空
		$("#select_feeType").val('');
		form.render("select");
	});
    
    //select费用类别监听
    form.on('select(add_select_feeType)', function(data) {
    	var feeType = data.value;
    	var optHtml = '';
    	$("#select_payType").html('');
    	$("#payTotal").val('');
    	optHtml += '<option value="">请选择-支付类别</option>';
    	if(feeType == '1' || feeType == '2' || feeType == '3'){
    		optHtml += '<option value="1">预付款</option>';
    		optHtml += '<option value="2">月度进度款</option>';
    		optHtml += '<option value="3">年度进度款</option>';
    		optHtml += '<option value="4">竣工付费</option>';
    		optHtml += '<option value="5">结算工程款</option>';
    		optHtml += '<option value="6">质保金返还</option>';
    		if(feeType == '1'){
    			$("#cotTypeName").val('内部协议');
    		}else if(feeType == '2'){
    			$("#cotTypeName").val('分包合同');
    		}else if(feeType == '3'){
    			$("#cotTypeName").val('设备合同');
    		}
    		$("#cotType").val(feeType);
    	}else if(feeType == '4'){//代付费
    		optHtml += '<option value="7">代付费</option>';
    		$("#cotTypeName").val('其他对内合同');
    		$("#cotType").val('4');
    	}else if(feeType == '5'){//前期费
    		optHtml += '<option value="8">前期费</option>';
    		$("#cotTypeName").val('其他对内合同');
    		$("#cotType").val('4');
    	}
    	$("#select_payType").append(optHtml);
    	form.render();
    	$(".detail").hide();
    	var proCode = $("#add_select_proId").find("option:selected").attr("procode");
    	if(proCode == null || proCode == ''){
    		return;
    	}
    	getCotByFeetype(feeType,proCode);
	});
    
    var feeType = $('#select_feeType').val();
    var proCode = $('#proCode').val();
    getCotByFeetype(feeType,proCode);
    
    /* var cotNames = $('#cotNames').val();
    console.log(cotNames)
    var select_cotName = $('#select_cotName').html();
    console.log(select_cotName) */
    
  	//select支付类别监听
    form.on('select(add_select_payType)', function(data){
    	$("#payTotal").val('');
    	var payType = data.value;
    	var feeType = $("#select_feeType").val();
    	var cotId = $("#select_cotName").val();
    	var sureMonth = $("#sent-laydate-year").val();
    	if(payType != ''){
    		if(feeType != '' && cotId !=''){
    			if(payType != '3'){
	    			getCotByCondition(feeType,payType,cotId,sureMonth,'');
	    		}else{
	    			var sureMonthStart = $("#yearPayBeginStr").val();
	    			var sureMonthEnd = $("#yearPayEndStr").val();
	    			if(sureMonthStart !='' && sureMonthEnd !=''){
	    				getCotByCondition(feeType,payType,cotId,sureMonthStart,sureMonthEnd);
	    			}
	    		}
    		}
    		//控制详情项显示与隐藏
   			$(".detail").each(function(){
   				 var elem = $(this).attr("id");
   				 $("#"+elem+" :input").val('');
   				 if(elem == 'detail'+payType){
   					 $("#"+elem).show();
   					 $("#"+elem+" .required").each(function(){
   						 var elemId = $(this).attr("id");
   						 if(elemId.indexOf('Str')!=-1){
   							$(this).attr("lay-verify","required");
   						 }else if(elemId.indexOf('Amount')!=-1){
   							$(this).attr("lay-verify","required|floatNumber");
   						 }else{
   							$(this).attr("lay-verify","required|floatAmount");
   						 }
   					 });
   				 }else{
   					$("#"+elem).hide();
   					$("#"+elem+" .required").each(function(){
  						 $(this).removeAttr("lay-verify");
  					 });
   				 }
   			});
    	}else{
    		$(".detail").hide();
    	}
	});
    
    $(function(){
	    var cotName = $("#cotNames").val();
		$("#cotName").val(cotName);
    });
  	
  	//select合同名称监听
    form.on('select(add_select_cotId)', function(data){
    	$("#payTotal").val('');
    	$(".detail :visible :input").val('');
    	var cotId = data.value;
    	var cotName = $("#select_cotName").find("option:selected").text();
    	$("#cotName").val(cotName);
    	var coopid = $("#select_cotName").find("option:selected").attr("coopid");
    	getCoopNameById(coopid);
    	var payType = $("#select_payType").val();
    	var feeType = $("#select_feeType").val();
    	var sureMonth = $("#sent-laydate-year").val();
    	if(payType != '' && feeType != '' && cotId !=''){
   			if(payType != '3'){
    			getCotByCondition(feeType,payType,cotId,sureMonth,'');
    		}else{
    			var sureMonthStart = $("#yearPayBeginStr").val();
    			var sureMonthEnd = $("#yearPayEndStr").val();
    			if(sureMonthStart !='' && sureMonthEnd !=''){
    				getCotByCondition(feeType,payType,cotId,sureMonthStart,sureMonthEnd);
    			}
    		}
    	}
	});
  	
  });
  
   //根据费用类型查询合同记录
   function getCotByFeetype(feeType,proCode){
	   var $ = layui.$
	  	,form = layui.form;
		$.ajax({
			type : "POST", //提交方式  
			url : "${ctx}/bizcostApply/getCotByFeetype",//路径  
			data : {
				"feeType" :feeType,
				"proCode" :proCode
			},//数据，这里使用的是Json格式进行传输  
			success : function(result) {//返回数据根据结果进行相应的处理 
				if(result.flag==true){
					var otherCotLists = result.cots;
					$("#select_cotName").html('');
					var cotNames = $('#cotNames').val();
					var tableTemplate = [];
					tableTemplate.push('<option value="">请选择</option>');
					layui.$.each(otherCotLists ,function (index, cot){
						if(feeType == '1'){
							if(cotNames==cot.innerAgrtName){
								tableTemplate.push('<option value="'+cot.id+'" selected coopid="'+cot.sgCoopId+'">'+cot.innerAgrtName+'</option>');
							}else{
								tableTemplate.push('<option value="'+cot.id+'" coopid="'+cot.sgCoopId+'">'+cot.innerAgrtName+'</option>');
							}
						}else if(feeType == '2'){
							if(cotNames==cot.subpackCotName){
								tableTemplate.push('<option value="'+cot.id+'" selected coopid="'+cot.sgCoopId+'">'+cot.subpackCotName+'</option>');
							}else{
								tableTemplate.push('<option value="'+cot.id+'" coopid="'+cot.sgCoopId+'">'+cot.subpackCotName+'</option>');
							}
						}else if(feeType == '3'){
							if(cotNames==cot.deviceCotName){
								tableTemplate.push('<option value="'+cot.id+'" selected coopid="'+cot.sgCoopId+'">'+cot.deviceCotName+'</option>');
							}else{
								tableTemplate.push('<option value="'+cot.id+'" coopid="'+cot.sgCoopId+'">'+cot.deviceCotName+'</option>');
							}
						}else{
							if(cotNames==cot.otherCotName){
								tableTemplate.push('<option value="'+cot.id+'" selected coopid="'+cot.sgCoopId+'">'+cot.otherCotName+'</option>');
							}else{
								tableTemplate.push('<option value="'+cot.id+'" coopid="'+cot.sgCoopId+'">'+cot.otherCotName+'</option>');
							}
						}
                       // $table.append(html.join(''));                         
                    });
					var $div = $("#select_cotName");
                    $div.append(tableTemplate.join(''));
					form.render();
				}else{
					layer.msg('数据通信异常~',{icon: 0});
				}
			} 
		});
   }
   
   //根据条件查询合同记录
   function getCotByCondition(feeType,payType,cotId,sureMonth,sureMonthEnd){
	   var $ = layui.$
	  	,form = layui.form;
	   	if(payType == '2' || payType == '7' || payType == '8'){
			if(sureMonth == ''){
				layer.msg('请选择确权月份~',{icon: 0});
				return;
			}
		}
	   	if(payType == '3'){
			if(sureMonth == ''){
				layer.msg('请选择年度付款开始月~',{icon: 0});
				return;
			}
			if(sureMonthEnd == ''){
				layer.msg('请选择年度付款结束月~',{icon: 0});
				return;
			}
		}
		$.ajax({
			type : "POST", //提交方式  
			url : "${ctx}/bizcostApply/getCotByFeetypeAndPaytype",//路径  
			data : {
				"feeType" :feeType,
				"payType" :payType,
				"id" :cotId,
				"sureMonth" :sureMonth,
				"sureMonthEnd" :sureMonthEnd
			},//数据，这里使用的是Json格式进行传输  
			success : function(result) {//返回数据根据结果进行相应的处理 
				if(result.flag==true){
					var cot = result.cotVo;
					form.val('add_info_from',cot); // 填充原值
					if(payType == '1'){
						$("#payTotal").val(cot['bizcostApplyDetail.prePayAmount']);	
					}
				}else{
					layer.msg('数据通信异常~',{icon: 0});
				}
			} 
		});
   }
   
   //根据id查询合作公司名
   function getCoopNameById(id){
	   var $ = layui.$
	  	,form = layui.form;
		$.ajax({
			type : "POST", //提交方式  
			url : "${ctx}/coopinfo/queryById",//路径  
			data : {
				"id" :id
			},//数据，这里使用的是Json格式进行传输  
			success : function(result) {//返回数据根据结果进行相应的处理 
				if(result.flag==true){
					var coopInfo = result.coopInfo;
					$("#sgCoopName").val(coopInfo.coopName);
				}else{
					layer.msg('数据通信异常~',{icon: 0});
				}
			} 
		});
   }
   var rgx = /^([-]?)([0-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/;
	//计算当月实际应付金额
	function calcMonthActAmount(obj){
		var $ = layui.$;
		if (obj.value == '' || obj.value == null) {
			return;
		}		
		var boolrgx = rgx.test(obj.value);// true
		if(!boolrgx){
			obj.value=0;
			//当月应付金额
			var monthShouldAmount = $("#monthShouldAmount").val();
			if(monthShouldAmount == ''){
				return;
			}
			var monthActAmount = 0;
			monthActAmount = parseFloat(monthShouldAmount)+parseFloat(obj.value);
			$("#monthActAmount").val(monthActAmount.toFixed(2));
			$("#payTotal").val(monthActAmount.toFixed(2));
			layer.msg('请输入正确数字，且保留两位小数！');
			return;
		}
		//当月应付金额
		var monthShouldAmount = $("#monthShouldAmount").val();
		if(monthShouldAmount == ''){
			return;
		}
		var monthActAmount = 0;
		monthActAmount = parseFloat(monthShouldAmount)+parseFloat(obj.value);
		$("#monthActAmount").val(monthActAmount.toFixed(2));
		$("#payTotal").val(monthActAmount.toFixed(2));
				
	}
	
	//计算年度实际应付金额
	function calcYearActPay(obj){
		var $ = layui.$;
		if (obj.value == '' || obj.value == null) {
			return;
		}
		var boolrgx = rgx.test(obj.value);// true
		if(!boolrgx){
			obj.value=0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return;
		}
		//年度应付金额
		var yearShouldAmount = $("#yearShouldAmount").val();
		if(yearShouldAmount ==''){
			return;
		}
		var yearActPay = 0;
		yearActPay = parseFloat(yearShouldAmount)+parseFloat(obj.value);
		$("#yearActPay").val(yearActPay.toFixed(2));
		$("#payTotal").val(yearActPay.toFixed(2));
				
	}
	
	//计算竣工应付款
	function calcOverShouldFee(obj){
		var $ = layui.$;
		if (obj.value == '' || obj.value == null) {
			return;
		}
		var boolrgx = rgx.test(obj.value);// true
		if(!boolrgx){
			obj.value=0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return;
		}
		//竣工应付金额
		var overShouldAmount = $("#overShouldAmount").val();
		if(overShouldAmount ==''){
			return;
		}
		var overShouldFee = 0;
		overShouldFee = parseFloat(overShouldAmount)+parseFloat(obj.value);
		$("#overShouldFee").val(overShouldFee.toFixed(2));
		$("#payTotal").val(overShouldFee.toFixed(2));
				
	}
	
	//计算竣工应付款
	function calcSettShouldAmount(obj){
		var $ = layui.$;
		if (obj.value == '' || obj.value == null) {
			return;
		}
		var boolrgx = rgx.test(obj.value);// true
		if(!boolrgx){
			obj.value=0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return;
		}
		//应付款
		var settShouldFee = $("#settShouldFee").val();
		if(settShouldFee ==''){
			return;
		}
		var settShouldAmount = 0;
		settShouldAmount = parseFloat(settShouldFee)+parseFloat(obj.value);
		$("#settShouldAmount").val(settShouldAmount.toFixed(2));
		$("#payTotal").val(settShouldAmount.toFixed(2));
	}
	
	//计算质保金返还金额
	function calcBackAmount(obj){
		var $ = layui.$;
		if (obj.value == '' || obj.value == null) {
			return;
		}
		var boolrgx = rgx.test(obj.value);// true
		if(!boolrgx){
			obj.value=0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return;
		}
		//实扣质保金
		var backQaAct = $("#backQaAct").val();
		if(backQaAct ==''){
			return;
		}
		var backAmount = 0;
		backAmount = parseFloat(backQaAct)-parseFloat(obj.value);
		$("#backAmount").val(backAmount.toFixed(2));
		$("#payTotal").val(backAmount.toFixed(2));
	}
	
	//计算本期应付代付费
	function calcReplaceShouldAmount(obj){
		var $ = layui.$;
		if (obj.value == '' || obj.value == null) {
			return;
		}
		var boolrgx = rgx.test(obj.value);// true
		if(!boolrgx){
			obj.value=0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return;
		}
		//代付费确权金额
		var replaceSureAmout = $("#replaceSureAmout").val();
		if(replaceSureAmout==''){
			replaceSureAmout = 0;
		}
		var replaceShouldAmount = 0;
		replaceShouldAmount = parseFloat(obj.value)*parseFloat(replaceSureAmout)/100;
		$("#replaceShouldAmount").val(replaceShouldAmount.toFixed(2));
		$("#payTotal").val(replaceShouldAmount.toFixed(2));
	}
	
	//计算本期应付前期费
	function calcFrontShouldAmount(obj){
		var $ = layui.$;
		if (obj.value == '' || obj.value == null) {
			return;
		}
		var boolrgx = rgx.test(obj.value);// true
		if(!boolrgx){
			obj.value=0;
			layer.msg('请输入正确数字，且保留两位小数！');
			return;
		}
		//前期费确权金额
		var frontSureAmount = $("#frontSureAmount").val();
		if(frontSureAmount==''){
			frontSureAmount = 0;
		}		
		var frontShouldAmount = 0;
		frontShouldAmount = parseFloat(obj.value)*parseFloat(frontSureAmount)/100;
		$("#frontShouldAmount").val(frontShouldAmount.toFixed(2));
		$("#payTotal").val(frontShouldAmount.toFixed(2));
	}
	
	//删除文件
	function del(index){
		layui.$("#fileAtt_"+index).remove();
		layui.$("#upload_img_"+index).remove();
	}
  
	//根据url查看文件
	function showImg(url){
		var openWin = window.open(url,'','left=410,height=768, width=1024, top=200,  toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
	}
  </script>
</body>
</html>

